The x position at pos (0..1) along a path, without moving anything.
path_x_at(p, pos) -> real| Name | Type |
|---|---|
p | path |
pos | real |
real
The x position at pos (0..1 along a path's own length) without moving anything - a read-only query, the building block a patrol that must respect walls combines with move_slide instead of following the path directly with path_start (see Rooms's own "Paths, briefly" section).
It is a place in the room, counted from the room's top-left corner, like an instance's own x.
A pos is a fraction the game keeps to about one part in four thousand, so it cannot name a corner of a long route to the last hair. It does not need to: give it the pos that is as close to a corner as a pos can get, and you get the corner itself, not a point a little short of it. On a route 400 pixels long whose first corner is 80 pixels along, path_x_at(route, 0.2) is the x of that corner.
var midpoint_x = path_x_at(path_doc_patrol, 0.5);Reads the x position exactly halfway along path_doc_patrol, without moving the walker or anything else.